package com.admin.module.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqConfig {
    public static final String FILE_CONVERTER_PDF_EXCHANGE = "file-converter-pdf-exchange";
    public static final String FILE_CONVERTER_PDF_QUEUE = "file-converter-pdf-queue";
    public static final String FILE_CONVERTER_PDF_ROUTING_KEY = "file-converter-pdf-routing-key";


    @Bean
    public DirectExchange fileConverterPdfExchange() {
        return new DirectExchange(FILE_CONVERTER_PDF_EXCHANGE);
    }

    @Bean
    public Queue fileConverterPdfQueue() {
        return new Queue(FILE_CONVERTER_PDF_QUEUE, true);
    }


    @Bean
    public Binding fileConverterPdfBinding(DirectExchange fileConverterPdfExchange, Queue fileConverterPdfQueue) {
        return BindingBuilder.bind(fileConverterPdfQueue).to(fileConverterPdfExchange).with(FILE_CONVERTER_PDF_ROUTING_KEY);
    }

}
